package com.dixon.worddayday.dao;

import com.dixon.worddayday.model.WordsTestDetail;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface WordsTestDetailRepository extends JpaRepository<WordsTestDetail, Integer> {
//    @Query("select count(distinct wordId) from Progress where customerId= :customerId")
    @Query(value = "select distinct d.word from words_test_detail d left join words_test t on d.test_id=t.id\n" +
            "where t.customer_id= :customerId and d.word=d.input and formatdatetime( t.create_time, 'yyyy-MM-dd')= :currDateStr ", nativeQuery = true)
    List<String> getTodayTestWords(@Param("customerId") Integer customerId, @Param("currDateStr") String currDateStr);
}
